$.ajaxSetup({
	xhrFields: {
        withCredentials: true // 携带跨域cookie
    },
    crossDomain: true,
    contentType: 'text/plain',
  	error: function(XMLHttpRequest, textStatus, errorThrown) {
		 var errorMsg="error in $.ajax():	"+
			 		  "\n	XMLHttpRequest.status:"+XMLHttpRequest.status+
		 			  "\n	XMLHttpRequest.readyState:"+XMLHttpRequest.readyState+
		 			  "\n	textStatus:"+textStatus+
		 			  "\n	errorThrown:"+errorThrown;
		 console.log(errorMsg);
	},
 	xhrFields: {withCredentials: true}
});
function request(obj){
	return new Promise((resolve, reject) => {
		$.ajax({
		  	async: true,
		  	type: obj.method,
		  	dataType: "text/plain",
		  	data: obj.data,
		  	url: obj.url,
		  	success: function(resp){
		  		resolve(resp)
		  	},
		  	error: function(e) {
					reject(e)
		  	}
		});
	})
}